package com.link2room.ironhide.entity;

import com.link2room.common.entity.BaseEntity;
import org.hibernate.annotations.DynamicInsert;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * Created by sss on 2016/10/11.
 */
@Entity
@Table(name = "l2r_district")
@DynamicInsert
public class L2RDistrict extends BaseEntity{
    public enum L2RDistrict_{
        cityCode,districtCode,districtName,searchCode
    }

    /**
     * 城市代码
     */
    private Long cityCode;
    /**
     * 行政区代码
     */
    private Long districtCode;
    /**
     * 行政区名称
     */
    private String districtName;
    /**
     * 检索代码
     */
    private String searchCode;

    @Basic
    @Column(name = "city_code", nullable = true)
    public Long getCityCode() {
        return cityCode;
    }

    public void setCityCode(Long cityCode) {
        this.cityCode = cityCode;
    }

    @Basic
    @Column(name = "district_code", nullable = true)
    public Long getDistrictCode() {
        return districtCode;
    }

    public void setDistrictCode(Long districtCode) {
        this.districtCode = districtCode;
    }

    @Basic
    @Column(name = "district_name", nullable = false, length = 16)
    public String getDistrictName() {
        return districtName;
    }

    public void setDistrictName(String districtName) {
        this.districtName = districtName;
    }

    @Basic
    @Column(name = "search_code", nullable = true, length = 64)
    public String getSearchCode() {
        return searchCode;
    }

    public void setSearchCode(String searchCode) {
        this.searchCode = searchCode;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        L2RDistrict that = (L2RDistrict) o;

        if (cityCode != null ? !cityCode.equals(that.cityCode) : that.cityCode != null) return false;
        if (districtCode != null ? !districtCode.equals(that.districtCode) : that.districtCode != null) return false;
        if (districtName != null ? !districtName.equals(that.districtName) : that.districtName != null) return false;
        if (searchCode != null ? !searchCode.equals(that.searchCode) : that.searchCode != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = cityCode != null ? cityCode.hashCode() : 0;
        result = 31 * result + (districtCode != null ? districtCode.hashCode() : 0);
        result = 31 * result + (districtName != null ? districtName.hashCode() : 0);
        result = 31 * result + (searchCode != null ? searchCode.hashCode() : 0);
        return result;
    }
}
